/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// pspin.hpp - PegSpinButton class definition.
//
// Author: Kenneth G. Maxwell
//
// Copyright (c) 1997-2000 Swell Software 
//              All Rights Reserved.
//
// Unauthorized redistribution of this source code, in whole or part,
// without the express written permission of Swell Software
// is strictly prohibited.
//
// Notes:
//
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

#ifndef _PSPIN_
#define _PSPIN_

class PegSpinButton : public PegThing
{
    public:
        PegSpinButton(const PegRect &Rect, PEGUINT Id = 0,
                      PEGULONG Style = AF_ENABLED|SB_VERTICAL);
        PegSpinButton(const PegRect &Rect, PegTextThing *buddy,
                      PEGLONG Min, PEGLONG Max, PEGINT Step, PEGUINT Id = 0,
                      PEGULONG Style = AF_ENABLED|SB_VERTICAL);

        virtual PEGINT Message(const PegMessage &Mesg);
        void SetBuddy(PegTextThing *buddy)
        {
            mpSlave = buddy;
            if (mpSlave)
            {
                mpSlave->SetCopyMode();
            }
        }
        void SetLimits(PEGLONG Min, PEGLONG Max, PEGINT Step = -1);
        void SetOutputWidth(PEGINT Width) {mOutputWidth = Width;}
                
    protected:

        enum MyButtonIds 
        {
            IDB_UPBUTTON = 1010,
            IDB_DOWNBUTTON,
            IDB_LEFTBUTTON,
            IDB_RIGHTBUTTON
        };

        void AddSpinButtons(void);
        void UpdateSlave(PEGUINT Dir);

        PegTextThing *mpSlave;
        PEGLONG mMin;
        PEGLONG mMax;
        PEGINT mStep;
        PEGINT mOutputWidth;
};

#endif

